"""
开放商户 - 商户签约信息修改相关模型
"""

from typing import Dict, Any
from jlpay.model.base import OrgBaseReq, BaseResponse
from jlpay.utils.annotation_utils import Encrypt


@Encrypt  # 标记整个类需要加密处理，对应Java代码中的@DataCrypto(encrypt = true)
class SignInfoModifyRequest(OrgBaseReq):
    """商户签约信息修改请求"""
    
    API_URL = "/open/merch/access/sign-info/modify"
    
    def __init__(self):
        """初始化商户签约信息修改请求"""
        super().__init__()
        self.apply_id = None  # 申请单号
        self.merch_no = None  # 商户号
        self.sign_mode = None  # 签约方式
        self.agreement_pic = None  # 纸质协议照片
        self.legal_person_phone = None  # 法人签约手机号码
        self.delegatee_phone = None  # 授权收款人签约手机号码
    
    def set_apply_id(self, apply_id):
        """
        设置申请单号
        
        Args:
            apply_id: 申请单号
            
        Returns:
            SignInfoModifyRequest实例
        """
        self.apply_id = apply_id
        return self
    
    def set_merch_no(self, merch_no):
        """
        设置商户号
        
        Args:
            merch_no: 商户号
            
        Returns:
            SignInfoModifyRequest实例
        """
        self.merch_no = merch_no
        return self
    
    def set_sign_mode(self, sign_mode):
        """
        设置签约方式
        
        Args:
            sign_mode: 签约方式
            
        Returns:
            SignInfoModifyRequest实例
        """
        self.sign_mode = sign_mode
        return self
    
    def set_agreement_pic(self, agreement_pic):
        """
        设置纸质协议照片
        
        Args:
            agreement_pic: 纸质协议照片
            
        Returns:
            SignInfoModifyRequest实例
        """
        self.agreement_pic = agreement_pic
        return self
    
    def set_legal_person_phone(self, legal_person_phone):
        """
        设置法人签约手机号码
        
        Args:
            legal_person_phone: 法人签约手机号码
            
        Returns:
            SignInfoModifyRequest实例
        """
        self.legal_person_phone = legal_person_phone
        return self
    
    def set_delegatee_phone(self, delegatee_phone):
        """
        设置授权收款人签约手机号码
        
        Args:
            delegatee_phone: 授权收款人签约手机号码
            
        Returns:
            SignInfoModifyRequest实例
        """
        self.delegatee_phone = delegatee_phone
        return self
    
    def to_dict(self) -> Dict[str, Any]:
        """
        将请求对象转换为字典
        
        Returns:
            字典对象
        """
        data = super().to_dict()
        data['apply_id'] = self.apply_id
        data['merch_no'] = self.merch_no
        data['sign_mode'] = self.sign_mode
        data['agreement_pic'] = self.agreement_pic
        data['legal_person_phone'] = self.legal_person_phone
        data['delegatee_phone'] = self.delegatee_phone
        return data


class SignInfoModifyResponse(BaseResponse):
    """商户签约信息修改响应参数"""
    
    def __init__(self, response_dict=None):
        """
        初始化商户签约信息修改响应
        
        Args:
            response_dict: 响应字典
        """
        super().__init__(response_dict)
        self.merch_no = None  # 商户号
        self.apply_id = None  # 业务申请编号
        
        if response_dict:
            self.merch_no = response_dict.get('merch_no')
            self.apply_id = response_dict.get('apply_id')
    
    def to_dict(self) -> Dict[str, Any]:
        """
        将响应对象转换为字典
        
        Returns:
            字典对象
        """
        data = super().to_dict()
        data['merch_no'] = self.merch_no
        data['apply_id'] = self.apply_id
        return data 